/**
 * @description 定义请求接口
 */

import Ajax from "./ajax";
import { USER_ADD, USER_ADDRESS, USER_CART, USER_CODE, USER_LOGIN, USER_MONEY } from '../config/url.config'

//定义注册接口
export function userAdd(data){
    return Ajax({
        url:USER_ADD,
        method:'PUT',
        data
    })
}


//获取验证码
export function userCode(phone){
    return Ajax({
        url:USER_CODE,
        method:'GET',
        params:{
            phone
        }
    })
}

//登录接口
export function userLogin(data){
    return Ajax({
        url:USER_LOGIN,
        method:'POST',
        data
    })
}

//购物车
export function addCart(data){
    return Ajax({
        url:USER_CART,
        method:'PUT',
        data
    })
}


//添加地址

export function addAddress(data){
    return Ajax({
        url:USER_ADDRESS,
        method:'PUT',
        data
    })
}

//保存余额
export function addMoneyApi(data){
    return Ajax({
        url:USER_MONEY,
        method:'PUT',
        data
    })
}